home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 78
/
(Vol 78) My Disc.iso
/
Games
/
okcukopek.swf
/
scripts
/
frame_4
/
DoAction.as
Wrap
Text File
|
2008-10-28
|
6KB
|
261 lines
this.stop();
FNscore = function(s, num)
{
var _loc2_ = 1;
while(_loc2_ <= 6)
{
_root.menu_mc[s + _loc2_].gotoAndStop(Math.floor(num / Math.pow(10,_loc2_ - 1)) % 10 + 1);
_loc2_ = _loc2_ + 1;
}
};
v = 0;
the = 0;
vx = 0;
vy = 0;
level = 1;
FNscore("l",level);
mission = 2;
FNscore("m",mission);
score = 0;
FNscore("s",score);
life = 2;
shot = false;
move_ok = true;
target_ok = true;
game_ok = false;
power_num = 4;
this.power_bar.bar._yscale = 0;
this.text_mc.gotoAndStop("start");
this.blank_btn.useHandCursor = false;
FNrotation = function()
{
if(shot)
{
var _loc2_ = 2;
while(_loc2_ <= 4)
{
if(_loc2_ != 2)
{
this["mc" + _loc2_].mc.gotoAndStop(2);
}
_loc2_ = _loc2_ + 1;
}
if(move_ok)
{
this.mc2.mc._xscale = 80;
this.mc2.mc._yscale = 80;
this.mc2.mc._x += vx;
this.mc2.mc._y += vy;
if(this.mc2.mc._x > 700)
{
move_ok = false;
target_ok = false;
if(life == 0)
{
levelup_ok = false;
_loc2_ = 1;
while(_loc2_ <= 4)
{
if(_loc2_ != 2)
{
this["mc" + _loc2_]._visible = false;
}
_loc2_ = _loc2_ + 1;
}
this.menu_mc.life.nextFrame();
this.mc.gotoAndStop("no");
}
else
{
life--;
this.menu_mc.life.nextFrame();
this.feedback_mc.gotoAndPlay(2);
}
}
}
}
else
{
_loc2_ = 1;
while(_loc2_ <= 4)
{
this["mc" + _loc2_].mc._rotation = Math.atan2(this["mc" + _loc2_]._ymouse,this["mc" + _loc2_]._xmouse) / 3.141592653589793 * 180;
if(this["mc" + _loc2_].mc._rotation <= -40)
{
this["mc" + _loc2_].mc._rotation = -39;
}
if(this["mc" + _loc2_].mc._rotation >= 20)
{
this["mc" + _loc2_].mc._rotation = 19;
}
_loc2_ = _loc2_ + 1;
}
}
};
FNhit = function()
{
if(this.mc2.mc.hit.hitTest(this.target_mc.hit) && target_ok)
{
move_ok = false;
target_ok = false;
this.mc2.mc.m.gotoAndPlay("hit");
mission--;
FNscore("m",mission);
this.plus_mc.gotoAndPlay(2);
this.plus_mc._y = this.target_mc._y + 110;
if(this.power_bar.bar._yscale == 100)
{
score += 200;
}
else
{
score += 100;
}
FNscore("s",score);
if(mission == 0)
{
levelup_ok = true;
var _loc2_ = 1;
while(_loc2_ <= 4)
{
if(_loc2_ != 2)
{
this["mc" + _loc2_]._visible = false;
}
_loc2_ = _loc2_ + 1;
}
game_ok = false;
this.mc.gotoAndStop("ok");
this.levelup.gotoAndPlay(2);
}
else
{
this.feedback_mc.gotoAndPlay(2);
}
this.mc2.mc._x = 368;
}
};
this.target_mc._y = 215;
yspeed = 10;
FNtargetmove = function()
{
if(target_ok)
{
if(this.target_mc._y + yspeed <= -15)
{
yspeed *= -1;
}
else if(this.target_mc._y + yspeed >= 225)
{
yspeed *= -1;
}
this.target_mc._y += yspeed;
}
};
FNpower = function()
{
if(shot)
{
if(this.power_bar.bar._yscale == 100)
{
this.mc2.mc.gotoAndStop(3);
}
else
{
this.mc2.mc.gotoAndStop(2);
}
}
else if(this.power_bar.bar._yscale <= 100)
{
this.power_bar.bar._yscale += power_num;
}
else
{
this.power_bar.bar._yscale = 0;
}
};
FNshot = function()
{
if(shot == false)
{
shot = true;
v = 30 + this.power_bar.bar._yscale / 5;
the = this.mc2.mc._rotation * 3.141592653589793 / 180;
vx = v * Math.cos(the);
vy = 1 * v * Math.sin(the);
arrow--;
FNscore("a",arrow);
}
};
FNreset = function()
{
v = 0;
the = 0;
vx = 0;
vy = 0;
shot = false;
move_ok = true;
target_ok = true;
this.power_bar.bar._yscale = 0;
this.mc2.mc._x = 0;
this.mc2.mc._y = 0;
this.mc2.mc._xscale = 100;
this.mc2.mc._yscale = 100;
var _loc2_ = 2;
while(_loc2_ <= 4)
{
this["mc" + _loc2_].mc.gotoAndStop(1);
_loc2_ = _loc2_ + 1;
}
};
FNlevelup = function()
{
FNreset();
var _loc2_ = 1;
while(_loc2_ <= 4)
{
if(_loc2_ != 2)
{
this["mc" + _loc2_].mc._rotation = 0;
this["mc" + _loc2_]._visible = true;
}
_loc2_ = _loc2_ + 1;
}
this.mc.gotoAndStop(1);
this.target_mc._y = 215;
this.levelup.gotoAndStop(1);
level++;
FNscore("l",level);
if(level < 8)
{
if(yspeed < 0)
{
yspeed -= 2;
}
else
{
yspeed += 2;
}
}
mission = level * 3;
FNscore("m",mission);
};
this.onEnterFrame = function()
{
if(_root.vol == 1)
{
soundOn();
}
else if(_root.vol == 0)
{
soundOff();
}
if(game_ok)
{
FNpower();
FNrotation();
FNhit();
FNtargetmove();
}
};